package com.example.testhiber.initPackage.task;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.testhiber.initPackage.business.utils.JsoupUtils;
import com.example.testhiber.initPackage.business.utils.StringKit;
import com.github.binarywang.java.emoji.EmojiConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

//import simple.project.websocket.WebSocketServer;

/**
 * @Title: 通讯录 临时计划任务
 * @Description: TODO(这里用一句话描述这个方法的作用)
 * @param @param 
 * @return @return 
 * @author fcy
 * @throws
 * @date  
 */
@Component
public class WifiTask {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * @param
     * @Return
     * @Date 2020/2/21
     */
    @Scheduled(cron = "0/2 * * * * *")
    public void jzxm() {

//        String sjh ="";
//        String uname ="";
//        System.out.println("cron init");
//        try {
//            String sql = "select cxrwjg,hisphone from wifi_record where deleted='0' ";//取第一条
////            String sql = "select cxrwjg,hisphone from wifi_record where deleted='0' limit 0,1";//取第一条
//            List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
//            for (Map<String,Object> m:maps){
//                String cxrwjg = StringKit.toString(m.get("cxrwjg"));
//                String result = JsoupUtils.gettjWifiCxjg(cxrwjg);
//                if(!"".equals(result)){
//                    System.out.println("result:"+result);
//                    String updateSql = " update wifi_record set result='"+result+"' where cxrwjg='"+cxrwjg+"'";
//                    jdbcTemplate.execute(updateSql);
//
//                    String updateSql2 = " update wifi_record set deleted='1' where cxrwjg='"+cxrwjg+"'";
//                    jdbcTemplate.execute(updateSql2);
//                }
//            }
//        }catch (Exception e){
////            String updateSql = "update mobile set deleted=2 where uname='"+uname+"' and mobile='" +sjh +"'" ;
////            jdbcTemplate.execute(updateSql);
//            e.printStackTrace();
//        }
    }



}
